//
// Created by lenovo on 2023/12/14.
//
#include<bits/stdc++.h>
using namespace std;

int main()
{
    string str;
    cin >> str;
    int n = 0, i = 0;
    cin >> n;
    while(n--)
    {
      for( i = 0;str[i] <= str[i + 1];)
      {
          i++;
      }
      str.erase(i, 1);
    }
     while(str[0] == '0' && str.size() > 1)
      str.erase(0,1);
    cout << str;
    return 0;
}